package com.huishen.edrivenew.bean;

import org.json.JSONObject;

import com.google.gson.Gson;
import com.huishen.edrivenew.base.BaseBean;
import com.huishen.edrivenew.util.TLog;

/**
 * 限制约课信息
 * @author wu
 *
 */

public class LessonLimitBean extends BaseBean {
    
    public int coachId;
    public int km2AM;
    public int km2EV;
    public int km2PM;
    public int km3AM;
    public int km3EV;
    public int km3PM;
    
    
    public static BaseBean parseJson(JSONObject jsonObj) {
        Gson gson = new Gson();
        
        LessonLimitBean bean = gson.fromJson(jsonObj.toString(), LessonLimitBean.class);

        return bean;
    }
    
    
    public int getkmcount(int subject, int timeType) {
        if(subject == 2) {
            return getKm2count(timeType);
        }
        if(subject == 3) {
            return getKm3count(timeType);
        }
        return 0;
    }
    
    
    
    private int getKm2count(int timeType) {
        if(timeType == 1) {
            return km2AM;
        } else if(timeType == 2) {
            return km2PM;
        } else if(timeType == 3) {
            return km2EV;
        }
        return 0;
    }
    
    private int getKm3count(int timeType) {
        if(timeType == 1) {
            return km3AM;
        } else if(timeType == 2) {
            return km3PM;
        } else if(timeType == 3) {
            return km3EV;
        }
        return 0;
    }
    
    
}
